/*
 * @Description:NewPage.js
 * @Author: rendc
 * @Date: 2021-10-20 09:49:35
 * @LastEditors: rendc
 * @LastEditTime: 2021-10-22 09:19:31
 */
import { Table, Space, message } from 'antd';
import { request } from 'umi';
const columns = [
  {
    title: 'No',
    dataIndex: 'no',
    key: 'no',
  },
  {
    title: 'Id',
    dataIndex: 'id',
    key: 'id',
    render: text => <a>{text}</a>,
  },
  {
    title: 'Name',
    dataIndex: 'name',
    key: 'name',
  },
  {
    title: '操作',
    key: 'id',
    render: (text, record) => (
      <Space size="middle">
        <a onClick={() => edit(record)}>编辑</a>
        <a onClick={() => del(record.id)}>删除</a>
      </Space>
    ),
  },
];
function edit (record) {
  console.log("编辑");
  console.log(record);
}
function del (id) {
  message.error('id为' + id + '的栏目已被删除（模拟）');
  console.log("删除" + id);
}
const myData = await request('http://203.195.246.58:8888/index/category/findAll', {});
const MyTable = () => {
  // const Tag = 'h1';
  // return (
  //   <div>
  //     <Tag>111</Tag>
  //   </div>
  // );
  return <Table columns={columns} dataSource={myData.data} />
}
export default MyTable
